<?php

namespace Wechat\Controller;

use Think\Controller;

class TaskController extends Controller  {

    public function endActivity() {

        $map['status'] = array("neq", 2);
        $map['begin_time'] = array("elt", date("Y-m-d H:i:s"));

        $activityList = D('Activity')->where($map)->select();

        if(!isNullOrEmpty($activityList)) {

            $activityIdList = rtrim(implode(',',array_column($activityList,'activity_id')),',');

            //改变状态
            $sql = "UPDATE __ACTIVITY__ 
                SET status = 2
                WHERE activity_id IN (" .$activityIdList. ")";

            M()->execute($sql);

        }

    }




}